package com.wfcm.entity;

import java.io.Serializable;
import java.math.BigDecimal;
import java.util.Date;
import java.util.List;



/**
 * 订单表管理
 * 
 * @author xlf
 * @email xlfbe696@gmail.com
 * @date 2018-01-22 18:57:19
 */
public class WfGoodsOrderEntity implements Serializable {
	private static final long serialVersionUID = 1L;
	
	//自增主键
	private Integer id;
	//订单编号（时分秒+4位随机）
	private String ordercode;
	//订单生成时间
	private Date ordertime;
	//订单支付方式（1.微信支付 2.）
	private Integer paytype;
	//订单状态（1.待付款2.待收货3.待评价4.已完成5.取消订单）
	private Integer orderstatus;
	//订单所属用户编号
	private Integer userid;
	//接收人
	private String recipient;
	//接收人电话
	private String recipientphone;
	//接收人地址
	private String recipientaddress;
	//接收人省市区
	private String recipientpcd;
	//邮政编码
	private String postcode;
	//运费
	private BigDecimal freight;
	//商品总金额
	private BigDecimal goodsamount;
	//订单总金额
	private BigDecimal orderamount;
	//铜钱使用
	private String coppercash;
	//用户来源
	private String usersource;
	//微信支付订单号
	private String transactionId;
	//备注-配置订单备注说明
	private String remark;
	//订单支付时间
	private Date orderpaytime;
	//订单信息备注
	private String orderremark;
	//优惠券ID
	private Integer couponsId;
	//优惠券使用说明
	private String couponsMemo;
	//订单花费铜钱数
	private BigDecimal spendcoin;
	//退货时间
	private Date backtime;
	//优惠信息
	private String activityinfo;
	//原铜钱
	private BigDecimal oldcoppercash;
	//新铜钱
	private BigDecimal newcoppercash;
	//金币
	private BigDecimal gold;
	//金币
	private BigDecimal newGold;
	//版本号
	private String version;
	//用户实体
	private WfMemberEntity memberEntity;
	
	private List<WfGoodsOrderRelationEntity>  goodsOrderRelationList;
	
	public List<WfGoodsOrderRelationEntity> getGoodsOrderRelationList() {
		return goodsOrderRelationList;
	}
	public void setGoodsOrderRelationList(List<WfGoodsOrderRelationEntity> goodsOrderRelationList) {
		this.goodsOrderRelationList = goodsOrderRelationList;
	}
	
	public String getVersion() {
		return version;
	}
	public void setVersion(String version) {
		this.version = version;
	}

	public BigDecimal getNewGold() {
		return newGold;
	}

	public void setNewGold(BigDecimal newGold) {
		this.newGold = newGold;
	}

	/**
	 * 设置：自增主键
	 */
	public void setId(Integer id) {
		this.id = id;
	}
	/**
	 * 获取：自增主键
	 */
	public Integer getId() {
		return id;
	}
	/**
	 * 设置：订单编号（时分秒+4位随机）
	 */
	public void setOrdercode(String ordercode) {
		this.ordercode = ordercode;
	}
	/**
	 * 获取：订单编号（时分秒+4位随机）
	 */
	public String getOrdercode() {
		return ordercode;
	}
	/**
	 * 设置：订单生成时间
	 */
	public void setOrdertime(Date ordertime) {
		this.ordertime = ordertime;
	}
	/**
	 * 获取：订单生成时间
	 */
	public Date getOrdertime() {
		return ordertime;
	}
	/**
	 * 设置：订单支付方式（1.微信支付 2.）
	 */
	public void setPaytype(Integer paytype) {
		this.paytype = paytype;
	}
	/**
	 * 获取：订单支付方式（1.微信支付 2.）
	 */
	public Integer getPaytype() {
		return paytype;
	}
	/**
	 * 设置：订单状态（1.待付款2.待收货3.待评价4.已完成5.取消订单）
	 */
	public void setOrderstatus(Integer orderstatus) {
		this.orderstatus = orderstatus;
	}
	/**
	 * 获取：订单状态（1.待付款2.待收货3.待评价4.已完成5.取消订单）
	 */
	public Integer getOrderstatus() {
		return orderstatus;
	}
	/**
	 * 设置：订单所属用户编号
	 */
	public void setUserid(Integer userid) {
		this.userid = userid;
	}
	/**
	 * 获取：订单所属用户编号
	 */
	public Integer getUserid() {
		return userid;
	}
	/**
	 * 设置：接收人
	 */
	public void setRecipient(String recipient) {
		this.recipient = recipient;
	}
	/**
	 * 获取：接收人
	 */
	public String getRecipient() {
		return recipient;
	}
	/**
	 * 设置：接收人电话
	 */
	public void setRecipientphone(String recipientphone) {
		this.recipientphone = recipientphone;
	}
	/**
	 * 获取：接收人电话
	 */
	public String getRecipientphone() {
		return recipientphone;
	}
	/**
	 * 设置：接收人地址
	 */
	public void setRecipientaddress(String recipientaddress) {
		this.recipientaddress = recipientaddress;
	}
	/**
	 * 获取：接收人地址
	 */
	public String getRecipientaddress() {
		return recipientaddress;
	}
	/**
	 * 设置：接收人省市区
	 */
	public void setRecipientpcd(String recipientpcd) {
		this.recipientpcd = recipientpcd;
	}
	/**
	 * 获取：接收人省市区
	 */
	public String getRecipientpcd() {
		return recipientpcd;
	}
	/**
	 * 设置：邮政编码
	 */
	public void setPostcode(String postcode) {
		this.postcode = postcode;
	}
	/**
	 * 获取：邮政编码
	 */
	public String getPostcode() {
		return postcode;
	}
	/**
	 * 设置：运费
	 */
	public void setFreight(BigDecimal freight) {
		this.freight = freight;
	}
	/**
	 * 获取：运费
	 */
	public BigDecimal getFreight() {
		return freight;
	}
	/**
	 * 设置：商品总金额
	 */
	public void setGoodsamount(BigDecimal goodsamount) {
		this.goodsamount = goodsamount;
	}
	/**
	 * 获取：商品总金额
	 */
	public BigDecimal getGoodsamount() {
		return goodsamount;
	}
	/**
	 * 设置：订单总金额
	 */
	public void setOrderamount(BigDecimal orderamount) {
		this.orderamount = orderamount;
	}
	/**
	 * 获取：订单总金额
	 */
	public BigDecimal getOrderamount() {
		return orderamount;
	}
	/**
	 * 设置：铜钱使用
	 */
	public void setCoppercash(String coppercash) {
		this.coppercash = coppercash;
	}
	/**
	 * 获取：铜钱使用
	 */
	public String getCoppercash() {
		return coppercash;
	}
	/**
	 * 设置：用户来源
	 */
	public void setUsersource(String usersource) {
		this.usersource = usersource;
	}
	/**
	 * 获取：用户来源
	 */
	public String getUsersource() {
		return usersource;
	}
	/**
	 * 设置：微信支付订单号
	 */
	public void setTransactionId(String transactionId) {
		this.transactionId = transactionId;
	}
	/**
	 * 获取：微信支付订单号
	 */
	public String getTransactionId() {
		return transactionId;
	}
	/**
	 * 设置：备注-配置订单备注说明
	 */
	public void setRemark(String remark) {
		this.remark = remark;
	}
	/**
	 * 获取：备注-配置订单备注说明
	 */
	public String getRemark() {
		return remark;
	}
	/**
	 * 设置：订单支付时间
	 */
	public void setOrderpaytime(Date orderpaytime) {
		this.orderpaytime = orderpaytime;
	}
	/**
	 * 获取：订单支付时间
	 */
	public Date getOrderpaytime() {
		return orderpaytime;
	}
	/**
	 * 设置：订单信息备注
	 */
	public void setOrderremark(String orderremark) {
		this.orderremark = orderremark;
	}
	/**
	 * 获取：订单信息备注
	 */
	public String getOrderremark() {
		return orderremark;
	}
	/**
	 * 设置：优惠券ID
	 */
	public void setCouponsId(Integer couponsId) {
		this.couponsId = couponsId;
	}
	/**
	 * 获取：优惠券ID
	 */
	public Integer getCouponsId() {
		return couponsId;
	}
	/**
	 * 设置：优惠券使用说明
	 */
	public void setCouponsMemo(String couponsMemo) {
		this.couponsMemo = couponsMemo;
	}
	/**
	 * 获取：优惠券使用说明
	 */
	public String getCouponsMemo() {
		return couponsMemo;
	}
	/**
	 * 设置：订单花费铜钱数
	 */
	public void setSpendcoin(BigDecimal spendcoin) {
		this.spendcoin = spendcoin;
	}
	/**
	 * 获取：订单花费铜钱数
	 */
	public BigDecimal getSpendcoin() {
		return spendcoin;
	}
	/**
	 * 设置：退货时间
	 */
	public void setBacktime(Date backtime) {
		this.backtime = backtime;
	}
	/**
	 * 获取：退货时间
	 */
	public Date getBacktime() {
		return backtime;
	}
	/**
	 * 设置：优惠信息
	 */
	public void setActivityinfo(String activityinfo) {
		this.activityinfo = activityinfo;
	}
	/**
	 * 获取：优惠信息
	 */
	public String getActivityinfo() {
		return activityinfo;
	}
	/**
	 * 设置：原铜钱
	 */
	public void setOldcoppercash(BigDecimal oldcoppercash) {
		this.oldcoppercash = oldcoppercash;
	}
	/**
	 * 获取：原铜钱
	 */
	public BigDecimal getOldcoppercash() {
		return oldcoppercash;
	}
	/**
	 * 设置：新铜钱
	 */
	public void setNewcoppercash(BigDecimal newcoppercash) {
		this.newcoppercash = newcoppercash;
	}
	/**
	 * 获取：新铜钱
	 */
	public BigDecimal getNewcoppercash() {
		return newcoppercash;
	}
	/**
	 * 设置：金币
	 */
	public void setGold(BigDecimal gold) {
		this.gold = gold;
	}
	/**
	 * 获取：金币
	 */
	public BigDecimal getGold() {
		return gold;
	}
	public WfMemberEntity getMemberEntity() {
		return memberEntity;
	}
	public void setMemberEntity(WfMemberEntity memberEntity) {
		this.memberEntity = memberEntity;
	}
	
	public static WfGoodsOrderEntity generateFreeEntity(Integer userId, String orderCode) {
		WfGoodsOrderEntity order = new WfGoodsOrderEntity();
		BigDecimal zero = new BigDecimal("0");
		order.setOrdercode(orderCode);//根据当前时间生成订单号，yyMMddHHmmssSSS + 0~1000000随机数
		order.setPaytype(1);//1、微信支付
		order.setUserid(userId);
		order.setUsersource("---h5");
		order.setCouponsId(0);
		order.setGoodsamount(zero);//商品总金额
		order.setOrderamount(zero);//支付总金额
		order.setOldcoppercash(zero);//老铜钱
		order.setSpendcoin(zero);//订单花费铜钱数
		order.setVersion("3.0");
		order.setCoppercash("使用铜钱抵扣" + zero + "元");//消耗的原铜钱
		order.setNewcoppercash(zero);//消耗的新铜钱
		order.setGold(zero);//消耗的金币
		order.setOrderstatus(4);//订单状态（1.待付款2.待收货3.待评价4.已完成5.取消订单）
		order.setOrdertime(new Date());
		order.setOrderpaytime(new Date());
		return order;
	}
}
